#include <iostream>
#include <algorithm>
using namespace std;

int a[10005];

int main() {
	while (1) {
		int x, n = 0, ans = 0;
		while (1) {
			cin >> x;
			if (x == -1) return 0;
			if (x == 0) break;
			a[n++] = x;
		}
		
		sort(a, a + n);
		
		for (int i = 0; i < n; ++i) {
			if (a[lower_bound(a, a + n, a[i] * 2)-a] == a[i] * 2) {
				ans += upper_bound(a, a + n, a[i] * 2) - lower_bound(a, a + n, a[i] * 2);
			}
		}
		cout << ans << endl;
	}
	return 0;
}
